CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
  
PROJECT( officeenv-kde )
  
ADD_DEFINITIONS( -fexceptions )

FIND_PACKAGE( Qt4 REQUIRED )
FIND_PACKAGE( KDE4 REQUIRED )
FIND_PACKAGE( OpenGL REQUIRED)
  
INCLUDE( ${QT_USE_FILE} )
  
QT4_ADD_RESOURCES( RC_SRCS
)

QT4_WRAP_UI( UI_HDRS  
  ./src/OfficeEnvConfigForm.ui   
)
  
QT4_WRAP_CPP( MOC_SRCS 
  ./src/OfficeEnvConfigForm.h
  ./src/OfficeEnvKDEPlugin.h
)

INCLUDE_DIRECTORIES( officeenv-kde
  ${CMAKE_BINARY_DIR} 
  ${KDE4_INCLUDE_DIR}
  ${OPENGL_INCLUDE_DIR}  
  ${CMAKE_INSTALL_PREFIX}/include
)

ADD_DEFINITIONS(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")

FIND_LIBRARY(OFFICEENV_LIB officeenv)

ADD_LIBRARY( officeenv-kde MODULE 
  ./src/OfficeEnvConfigForm.cpp
  ./src/OfficeEnvKDEPlugin.cpp 
  ${MOC_SRCS} 
  ${RC_SRCS} 
  ${UI_HDRS} 
)

SET_TARGET_PROPERTIES( officeenv-kde PROPERTIES PREFIX "")

TARGET_LINK_LIBRARIES( officeenv-kde 
  ${QT_LIBRARIES} 
  ${OPENGL_LIBRARIES}
  ${OFFICEENV_LIB}
  kdecore 
  kdeui
  kwineffects  
)

INSTALL (TARGETS officeenv-kde DESTINATION lib)